package
{
	import com.greensock.*;
	import com.greensock.easing.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.geom.*;
	import flash.media.*;
	import flash.net.*;
	import flash.printing.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	import flash.xml.*;
	
	public class Button_sample extends Sprite
	{
		private var button:Sprite;
			
		public function Button_sample(_button:Sprite, _click:Function):void
		{
			button = _button;
			
			button.buttonMode = true;
			button.addEventListener(MouseEvent.CLICK, _click);
			button.addEventListener(MouseEvent.MOUSE_OVER, button_over);
			button.addEventListener(MouseEvent.MOUSE_OUT, button_out);
		}
		
				
		private function button_over(event:MouseEvent):void
		{
			button.transform.colorTransform = new ColorTransform(1.2, 1.2, 1.2);
			button.scaleX = .9;
			button.scaleY = .9;
			TweenLite.to(button, 1, {scaleY:1, scaleX:1, ease:Elastic.easeOut } );
		}
		
		private function button_out(event:MouseEvent):void
		{
			button.transform.colorTransform = new ColorTransform(1, 1, 1);
			if (button.mouseX > 0)
			{
				button.rotation = -10;
			} 
			else 
			{
				button.rotation = 10;
			}
			TweenLite.to(button, 1, { rotation:0, ease:Elastic.easeOut } );
		}
		
				
	}
}